package cliente.GUI;

import java.awt.*;
import javax.swing.*;
import servidor.*;

public class PanelGps extends JPanel
{

	/**
	 * 
	 */
	private static final long serialVersionUID = 1L;

	/**
	 * @param args
	 */
	
	JLabel nombre;
	JButton on;
	JButton off;
	JButton coordenadas;
	
	public PanelGps(GPS gps)
	{
		nombre = new JLabel("       GPS");
		on = new JButton("ON");
		off = new JButton("OFF");
		coordenadas = new JButton("COORDENADAS");
		
		if(gps == null)
		{
			on.setEnabled(false);
			off.setEnabled(false);
			coordenadas.setEnabled(false);
		}
		
		JPanel p = new JPanel();
		p.setLayout(new GridLayout(1, 3));
		p.add(nombre);
		JPanel n = new JPanel();
		n.add(on);
		p.add(n);
		JPanel f = new JPanel();
		f.add(off);
		p.add(f);
		
		this.setLayout(new GridLayout(2, 1));
		this.add(p);
		JPanel h = new JPanel();
		h.add(coordenadas);
		this.add(h);
	}
	
	public void cargarGps(GPS gps)
	{
		on.setEnabled(true);
		off.setEnabled(true);
		coordenadas.setEnabled(true);
	}
	
	public static void main(String[] args)
	{
		// TODO Auto-generated method stub
		JFrame f = new JFrame();
		f.setLayout(new BorderLayout());
		GPS gps = new GPS(false);
		f.add(new PanelGps(gps), "Center");
		f.pack();
		f.setVisible(true);
	}

}